<div id="block-comments" class="block">
  <div class="secondary-navigation">
    <ul>
      <li class="first"><%=link_to @product.name ,product_path(@product) %></li>
      <li class="first"><%=link_to '咨询' ,product_product_contacts_path(@product) %></li>
       <li class="first active"><%=link_to '评论' ,product_product_comments_path(@product) %></li>
    </ul>
    <div class="clear">   </div>
  </div>
  <div class="content">
    <h2 class="title">商品评论</h2>
    <div class="inner">
      
      <%= image_tag(@product.product_images.first.try(:image).try(:url).to_s, :size=>'300x200') %>
<br /><br />
      <table class="table">
        <tr>
          <th>评论</th>
          <th>建议调整价</th>
          <th>用户</th>
          
        </tr>
        
        <% @product_comments.each do |product_comment| %>
          <tr>
            <td><%=h product_comment.content %></td>
            <td><%=h product_comment.price %></td>
            <td><%=h product_comment.user.try(:name) %></td>
          </tr>
        <% end %>
      </table>
      <%= will_paginate @product_comments %>
      <br />
      <br />
     
      <% form_for ProductComment.new ,:url => product_product_comments_path(@product) ,:html => {:class => "no-floating form"} do |f| %>
        <input id="product_comment_user_id" type="hidden" name="product_comment[user_id]" value="<%=session[:user_id]%>"/>
        <%= f.hidden_field :product_id %>
        <table class="table">
          <tbody>
            <tr class="odd">
              <td>评论</td><td><%= f.text_area :content,:size => "50x5" %></td>
            </tr>
            <tr class="odd">
              <td>调整价格</td><td><%= f.text_field :price %>&nbsp;注：正为加价，负为减价</td>
            </tr>
            <tr class="odd">
              <td></td>   
              <td align="right" >  <input type="submit" value='提交' class="button"  /> </td>
            </tr>
          </tbody>
        </table>
      <% end %>
    </div>
  </div>                               
</div>


